import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @program: Learning
 * @description:
 * @Company: 汇华(北京)信息咨询服务有限公司
 * @author: peter.wei
 * @create: 2020-07-28 16:46
 **/
public class TestStr {
    public static void main(String[] args) {
        List<String> list  = new ArrayList<>();
        list.add("1");
        list.add("2");
        list.add("3");
        String collect = list.stream().map(e -> "\'" + e + "\'").collect(Collectors.joining(", "));
        collect = "("+collect+")";
        System.out.println(collect);
        System.out.println(list.toString());

        System.out.println(getSingleSurveyUser("1212,3232"));
        System.out.println(getSingleSurveyUser(""));
    }

    public static String getSingleSurveyUser(String input){
        if(input.length() > 0){
            if(input.contains(",")){
                return input.split(",")[0];
            }else{
                return input;
            }
        }else{
            return input;
        }
    }
}
